<?php 
// header("Location: ./index_main.php");
// header("Location: ./index_main.php");
//连接数据库
require("./include/init.php");
date_default_timezone_set('Asia/Shanghai');
$mysql=mysql::getIns();

//在此页面接收用户的uid,然后分别跳转到不同的页面
$uid=$_REQUEST['userid'];
if(empty($uid)){
	header('Location: ./404.html');
}else{
	// echo $uid;
	$sql="select * from yonghu where userid='" . $uid . "'";
	$data=$mysql->getRow($sql);
	//店名
	$shopname=$data[3];
	$name=include('./include/rolename.inc.php');
	$role=$data[1];
	// echo $role;
	$url=$name["$role"];
	$sql="select * from accesslog where userid='" . $uid . "'";
	$row=$mysql->getRow($sql);
	if(empty($row)){
		$sql="insert into accesslog (userid,logintime) values ('" . $uid . "','" . time() . "')";
		echo $sql;
		$mysql->query($sql);
	}else{
		$sql="update accesslog set logintime='" . time() . "' where userid='" . $uid . "'";
		echo $sql;
		$mysql->query($sql);
	}
	header("Location: $url?address=$data[3]&uid=$uid&area=$data[2]");
	/*print_r($data);
	[rolename] => DCC经理
	[rolename] => 市场总监
	[rolename] => 接待顾问
	[rolename] => 经销商市场专员
	[rolename] => DCC顾问
	[rolename] => 电销顾问
	[rolename] => 市场部
	[rolename] => 总经理
	[rolename] => 销售总监
	[rolename] => 销售经理
	[rolename] => 系统管理员
	[rolename] => 总部
	[rolename] => 内部企划
	[rolename] => 区域经理
	[rolename] => DCC顾问,电销顾问,接待顾问
	[rolename] => 内容管理员
	[rolename] => 内容中心
	[rolename] => 战略运营与管理部
	[rolename] => 系统供应商
	*/
}
 ?>
